package cn.broadsense.convert;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson2.JSONObject;

import java.util.Date;

/**
 * 类型转换
 *
 * @author pengxin
 * @date 2022-10-17 17:25
 */
public class Transform {

    public static String toJsonString(Object o) {
        return JSONObject.toJSONString(o);
    }

    public static Date currentTime() {
        return DateUtil.date();
    }

    public static Date longToDate(long timeStamp) {
        return new Date(timeStamp);
    }

    public static Long currentTimeLong() {
        return DateUtil.date().getTime();
    }

    public static Date timeStampToDate(long timeStamp) {
        return new DateTime(timeStamp);
    }
}
